const uniq = require('uniq');

let arr = [1,2,3,2,1,2,2];

console.log(uniq(arr)); //[ 1, 12, 2, 23, 3, 4 ]